package com.base.util.javautils.observer;

import android.support.annotation.NonNull;

/**
 * Created by gj on 16-1-24.
 */
public interface IObservableController {
    /**
     * Adds the specified observer to the list of observers. If it is already
     * registered, it is not added a second time.
     *
     * @param observer the Observer to add.
     */
    void registerObserver(@NonNull IObserver observer);

    /**
     * Removes the specified observer from the list of observers. Passing null
     * won't do anything.
     *
     * @param observer the observer to remove.
     */
    void unregisterObserver(@NonNull IObserver observer);

    /**
     * 用于某个观察者处理完后取消继续向下通知
     */
    void cancelNextNotify();

    /**
     * calls the {@code update()}
     * method for every Observer in the list of observers using the specified
     * argument.
     *
     * @param data the argument passed to {@code update()}.
     */
    void notifyObservers(@NonNull AbstractObserverMessage data);
}
